package com.onegroup.common.handler;

import com.onegroup.common.enums.ResponseStatusEnum;
import com.onegroup.common.exception.MyCustomException;
import com.onegroup.pojo.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author: 曾雪斌
 * @Description:
 * @History:
 */
@RestControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(MyCustomException.class)
    public static <T> ResponseResult<T> knowError(MyCustomException exception) {
        return new ResponseResult<>(exception.getResponseStatusEnum());
    }

}
